<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title></title>
    <link rel="stylesheet" href="{$Assets}layui/css/layui.css">


    
    <style type="text/css">
.layui-table-body{
    overflow: hidden;
}
.class1{width: 10px;display: inline-block;height: 10px;}
.class2{width: 40px;display: inline-block;height: 10px;}
.class3{width: 70px;display: inline-block;height: 10px;}
.class4{width: 100px;display: inline-block;height: 10px;}
.class5{width: 130px;display: inline-block;height: 10px;}

.class6{width: 160px;display: inline-block;height: 10px;}
.class7{width: 190px;display: inline-block;height: 10px;}
.class8{width: 220px;display: inline-block;height: 10px;}
.class9{width: 250px;display: inline-block;height: 10px;}
.class10{width: 280px;display: inline-block;height: 10px;}
    </style>
</head>
<body>



<div style="width: 98%;margin:35px auto;">
    <form class="layui-form" action="">
      <input type="hidden" name="id" value="{$info.id}">
      <div class="layui-form-item">
        <label class="layui-form-label">栏目名称</label>
        <div class="layui-input-inline">
          <input type="text" name="classname" value="{$info.classname}" lay-verify="classname" autocomplete="off" placeholder="q" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
          <label class="layui-form-label">所属栏目</label>
          <div class="layui-input-inline" style="color: #000;width: 320px;">
            <select name="pid" lay-verify="required">
              <option value="0">一级栏目</option>
              {volist name="column" id="vo" }
                  <option value="{$vo.id}" 
                    {if condition="$info.pid == $vo.id"} selected="" {/if}
                  ><?php echo str_repeat("&#8195;", $vo['level']);?>{if condition="$vo.level !=1"}{/if}{$vo.classname}</option>
              {/volist}
            </select>
          </div>

          <label class="layui-form-label">类型</label>
          <div class="layui-input-inline" style="color: #000;width: 100px;">
            <select name="type" lay-verify="required">
              <option value=""></option>
              
                  <option value="product" 
                    {if condition="$info.type == 'product'"} selected="" {/if}
                  >产品</option>
                  <option value="about" 
                    {if condition="$info.type == 'about'"} selected="" {/if}
                  >单页面</option>
              
            </select>
          </div>
      </div>



      <div style="margin:0 auto 20px; width: 90%;">
        <textarea class="layui-textarea" id="LAY_demo2" style="display: none">{$info.content}</textarea>
      </div>  
      <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn" lay-submit="" lay-filter="edit">提交</button>
          <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
      </div>



    </form>






</div>

<script src="{$Assets}layui/layui.js?t=1515376178709"></script>
<script>
layui.use(['form', 'layedit', 'laydate','table'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit

  ,laydate = layui.laydate,
  $ = layui.jquery;
  

  
  //
var index = layedit.build('LAY_demo2');



  //
  form.verify({
    classname: function(value){
      if(value.length < 2){
        return '';
      }
    }
    
    ,content: function(value){
      layedit.sync(editIndex);
    }
  });
  

  
  //
  form.on('submit(edit)', function(data){
    


    var datas=JSON.stringify(data.field);
    var content=layedit.getContent(index);
    var iframe = parent.layer.getFrameIndex(window.name);

  

                  $.ajax({
                        type:"POST",
                        url: "{:url('product/savecolumn')}",
                        data:{data:datas,content:content},
                        dataType:"json",

                        success:function(ret_datas){
                            if(ret_datas==1){
                                layer.msg('修改成功!');
                            }else if(ret_datas==99){
                                layer.msg('修改异常！');
                            }else{
                                layer.msg(ret_datas);
                            }
                            setTimeout(function(){
                              parent.layer.close(iframe);
                            },"1000");
                           

                        }
                    });


    return false;
  });


  
  
});
</script>
{include file="public/footer"/}
</body>
</html>